package de.tudarmstadt.fgbs.cafe.tests.core;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

import org.junit.Before;
import org.junit.Test;

import de.tudarmstadt.fgbs.cafe.core.MicroCoreSystem;
import de.tudarmstadt.fgbs.cafe.exception.FlawedConfigurationException;
import de.tudarmstadt.fgbs.cafe.structure.Fahrplan;

public class SimpleImportTest {

    private MicroCoreSystem instance;
    private String singleTrainFPLPath = "C:/Users/Chris/workspace/cafe-fpltool/tests/data/SingleTrain.FPL";
    private String shortFPLPath = "C:/Users/Chris/workspace/cafe-fpltool/tests/data/REGIO2011_short.FPL";
    private String fullFPLPath = "C:/Users/Chris/workspace/cafe-fpltool/tests/data/REGIO2011.FPL";

    @Before
    public void initialize() {
	instance = MicroCoreSystem.getInstance();
    }

    @Test
    public void simpleImport() throws FlawedConfigurationException {
	Fahrplan test = instance.importFPL(singleTrainFPLPath);
	assertNotNull(test);
	Fahrplan test1 = instance.importFPL(shortFPLPath);
	assertNotNull(test1);
	Fahrplan test2 = instance.importFPL(fullFPLPath);
	assertNotNull(test2);
    }

    @Test
    public void countImportedZL() throws FlawedConfigurationException {
	Fahrplan test = instance.importFPL(singleTrainFPLPath);
	assertEquals("Number of ZL is incorrect: is "
		+ test.getZuglaeufe().size() + " should be 1", test
		.getZuglaeufe().size(), 1);
	Fahrplan test1 = instance.importFPL(shortFPLPath);
	assertEquals("Number of ZL is incorrect: is "
		+ test1.getZuglaeufe().size() + " should be 7", test1
		.getZuglaeufe().size(), 7);
	Fahrplan test2 = instance.importFPL(fullFPLPath);
	assertEquals("Number of ZL is incorrect: is "
		+ test2.getZuglaeufe().size() + " should be 7", test2
		.getZuglaeufe().size(), 7);
    }
}
